package com.education.wisdom.service.impl;

import com.education.common.utils.Convert;
import com.education.wisdom.mapper.CatalogEarningMapper;
import com.education.wisdom.pojo.CatalogEarning;
import com.education.wisdom.service.ICatalogEarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 教你赚资源目录体系 服务层实现
 *
 * @author ruoyi
 * @date 2019-06-10
 */
@Service
public class CatalogEarningServiceImpl implements ICatalogEarningService {
    @Autowired
    private CatalogEarningMapper catalogEarningMapper;

    /**
     * 查询教你赚资源目录体系信息
     *
     * @param catalogCode 教你赚资源目录体系ID
     * @return 教你赚资源目录体系信息
     */
    @Override
    public CatalogEarning selectCatalogEarningById(String catalogCode) {
        return catalogEarningMapper.selectCatalogEarningById(catalogCode);
    }

    /**
     * 查询教你赚资源目录体系列表
     *
     * @param catalogEarning 教你赚资源目录体系信息
     * @return 教你赚资源目录体系集合
     */
    @Override
    public List<CatalogEarning> selectCatalogEarningList(CatalogEarning catalogEarning) {
        return catalogEarningMapper.selectCatalogEarningList(catalogEarning);
    }

    /**
     * 新增教你赚资源目录体系
     *
     * @param catalogEarning 教你赚资源目录体系信息
     * @return 结果
     */
    @Override
    public int insertCatalogEarning(CatalogEarning catalogEarning) {
        return catalogEarningMapper.insertCatalogEarning(catalogEarning);
    }

    /**
     * 修改教你赚资源目录体系
     *
     * @param catalogEarning 教你赚资源目录体系信息
     * @return 结果
     */
    @Override
    public int updateCatalogEarning(CatalogEarning catalogEarning) {
        return catalogEarningMapper.updateCatalogEarning(catalogEarning);
    }

    /**
     * 删除教你赚资源目录体系对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCatalogEarningByIds(String ids) {
        return catalogEarningMapper.deleteCatalogEarningByIds(Convert.toStrArray(ids));
    }

    /**
     * 通过ParentId查询下级目录
     *
     * @param s
     * @return
     */
    @Override
    public List<CatalogEarning> selectByParentId(Integer s) {
        return catalogEarningMapper.selectByParentId(s);
    }

}
